﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EmployeeListControl.ascx.cs" Inherits="WebUI.UserControls.EmployeeListControl" %>

   <asp:GridView runat="server" ID="grvEmployee" Width="100%" AutoGenerateColumns="false"
        OnRowDataBound="grvEmployee_RowDataBound" OnRowCreated="grvEmployee_RowCreated"
        OnRowCommand="grvEmployee_RowCommand" OnPageIndexChanging="grvEmployee_PageIndexChanging">
        <Columns>
            <asp:TemplateField>
                <ItemStyle Width="16" />
                <ItemTemplate>
                    <input type="checkbox" name="chkSelect" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ID" Visible="false" />
            <asp:BoundField DataField="EmpID" HeaderText="MSNV" ItemStyle-CssClass="openmenu" />
            <asp:BoundField DataField="Name" HeaderText="Họ tên" />
            <asp:BoundField DataField="DOB" HeaderText="Năm sinh" DataFormatString="{0:dd/MM/yyyy}" />
             <asp:BoundField DataField="PositionName" HeaderText="Chức vụ" />
            <asp:BoundField DataField="DepartmentName" HeaderText="Phòng ban" />
            <asp:BoundField DataField="Status" HeaderText="Tình trạng" />
            <asp:TemplateField HeaderText="Hình">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                    <a href='javascript:viewPicture(<%# Eval("ID")%>)' style="font-size: 8pt;">Xem</a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                    <div runat="server" id="divAction" style="font-size: 8pt;">
                        <asp:LinkButton runat="server" ID="LinkButton3" Text="Chi tiết" CommandArgument='<%#Eval("ID") %>'
                            CommandName="ViewEmp"></asp:LinkButton>
                        <asp:LinkButton runat="server" ID="lnkEdit" Text="Sửa" CommandArgument='<%#Eval("ID") %>'
                            CommandName="EditEmp"></asp:LinkButton>
                        <asp:LinkButton runat="server" ID="lnkDelete" Text="Xóa" CommandArgument='<%#Eval("ID") %>'
                            CommandName="DeleteEmp"></asp:LinkButton>
                        <asp:LinkButton runat="server" ID="LinkButton1" Text="HĐLĐ" CommandArgument='<%#Eval("ID") %>'
                            CommandName="EmployeeContract"></asp:LinkButton>
                        <asp:LinkButton runat="server" ID="LinkButton2" Text="Phép" CommandArgument='<%#Eval("ID") %>'
                            CommandName="EmployeeLeave"></asp:LinkButton>
                             <asp:LinkButton runat="server" ID="LinkButton4" Text="Thưởng" CommandArgument='<%#Eval("ID") %>'
                            CommandName="EmployeeReward"></asp:LinkButton>
                             <asp:LinkButton runat="server" ID="LinkButton5" Text="Kỷ luật" CommandArgument='<%#Eval("ID") %>'
                            CommandName="EmployeeDiscipline"></asp:LinkButton>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <div class="message">
                Không có nhân viên nào.
            </div>
        </EmptyDataTemplate>
    </asp:GridView>
   
    <script language="javascript" type="text/javascript">       
        function selectAll(id)
        {
            var value=document.getElementById(id).checked;
            var chkGroup = document.getElementsByName('chkSelect');
            for(i=0;i<chkGroup.length;i++)
            {
                chkGroup[i].checked=value;
            }
        }
        
        function viewPicture(id)
        {
            var url='ViewPicture.aspx?id=' + id;
            var features= 'center:yes;resizable:no;scroll:no;status:no;dialogWidth:100px;dialogHeight:300px;';
            window.showModalDialog(url,null,features);
        }
        
    </script>
